import { api } from "@/lib/request";
import type { RegisterFormData, VerifyFormData } from "@/schemas/register";
import type { Response } from "@/types/response";



// 认证API
export const registerAPI = {
  // 注册
  register: async (data: RegisterFormData): Promise<Response> => {
    const response = await api.post("/cas/register", data);
    return response as unknown as Response;
  },
  verify: async (data: VerifyFormData): Promise<Response> => {
    // 对密码进行 base64 编码
    const encodedData = {
      ...data,
      password: btoa(data.password) // 使用 btoa 进行 base64 编码
    };
    const response = await api.post("/cas/register/verify", encodedData);
    return response as unknown as Response;
  },
};
